package cn.walls1717.wallsmall.ware.config;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;

/**
 * Mybatis配置类
 *
 * @author walls1717
 * @since 2022/10/30 15:02
 **/
@Configuration
@EnableTransactionManagement
@MapperScan("cn.walls1717.wallsmall.ware.dao")
public class MybatisConfig {

    /**
     * MybatisPlus分页配置
     *
     * @return MybatisPlus拦截器
     */
    @Bean
    public MybatisPlusInterceptor interceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }
}
